package Demo11;

import java.util.concurrent.*;

public class ThreadPool {
    public static void main(String[] args) {

        /**
         * ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor
         * (核心线程数，最大线程数量，空闲线程最大存活时间，时间单位，任务队列，线程工厂，任务的拒绝策略)
         */

        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                3, //核心线程数
                6, //最大线程数量
                60, //空闲线程最大存活时间
                TimeUnit.SECONDS, //时间单位
                new ArrayBlockingQueue<Runnable>(3), //任务队列
                Executors.defaultThreadFactory(), //线程工厂
                new ThreadPoolExecutor.AbortPolicy() //任务的拒绝策略
        );

    }
}
